#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "base/CTFile.h"
#include "CTArray.h"
#include "CTKeyValue.h"
#include "CTSizeString.h"

using namespace CTLib;

int main(int argc, char *argv[])
{
    if (argc < 1)
    {
        return 0;
    }

    int iRet = 0;
    int iLen = 0;
    CTReadFile stReadFile;
    iRet = stReadFile.Open(argv[1]);
    if (iRet){return iRet;}

    CTKeyValue stKeyValue;
    char* szLine = stReadFile.ReadLine();
    while (szLine != NULL)
    {
        iLen = strlen(szLine);
        stKeyValue.Clear();
        stKeyValue.ParseFromHttpParam(szLine, iLen, false);
        printf("==================================\n");
        for (int i = 0; i < stKeyValue._astKeyValueData.Size(); ++i)
        {
            printf("%s|%s\n",stKeyValue._astKeyValueData[i]._szKey(),
                stKeyValue._astKeyValueData[i]._szValue());
        }

        szLine = stReadFile.ReadLine();
    }

    return 0;
}

